package com.corpgovernment.common.apollo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @ClassName: HotelApollo
 * @description: 酒店阿波罗配置
 * @author: ezchen
 * @date: Created in 15:59 2020/7/9
 * @Version: 1.0
 **/
@Component
public class IntlHotelApollo extends CommonApollo {

    /**
     * 酒店匹配度
     */
    @Value("${mapping.matchPercent:0.8}")
    private Double matchPercent;
    /**
     * 最大距离
     */
    @Value("${mapping.maxDistance:5000}")
    private Integer maxDistance;
    /**
     * 酒店图片路径
     */
    @Value("${ctrip.file.prefix:http://images4.fx.ctripcorp.com/target/}")
    private String ctripHotelPicUrlPrefix;
    /**
     * 停留时间校验 时间/秒
     */
    @Value("${bookTimeout:1200}")
    private Long bookTimeout;
	/**
	 * 超时未确认 时间/分钟
	 */
	@Value("${timeoutNotConfirm:30}")
	private Integer timeoutNotConfirm;
    /**
     * 模糊搜索的服务商code
     */
    @Value("${searchLocation.supplierCode:}")
    private String searchLocationSupplierCode;
    /**
     * 模糊搜索的服务商corpId
     */
    @Value("${searchLocation.supplierCorpId:}")
    private String searchLocationSupplierCorpId;
    /**
     * 酒店查询接口超时时间，单位：秒
     */
    @Value("${supplierTimeOut:20}")
    private Long supplierTimeOut;
    /**
     * 酒店列表缓存时间，单位：秒
     */
    @Value("${HotelListCacheTime:1800}")
    private Long hotelListCacheTime;

    /**
     * 酒店匹配度
     */
    public Double getMatchPercent() {
        return Double.valueOf(getAppProperty("mapping.matchPercent", "0.8"));
    }
    /**
     * 最大距离
     */
    public Integer getMaxDistance() {
        return Integer.parseInt(getAppProperty("mapping.maxDistance", "5000"));
    }
    /**
     * 酒店图片路径
     */
    public String getCtripHotelPicUrlPrefix() {
        return getAppProperty("ctrip.file.prefix", "http://images4.fx.ctripcorp.com/target/");
    }
    /**
     * 停留时间校验 时间/秒
     */
    public Long getBookTimeout() {
        return Long.valueOf(getAppProperty("bookTimeout", "1200"));
    }
    /**
     * 超时未确认 时间/分钟
     */
    public Integer getTimeoutNotConfirm() {
        return Integer.parseInt(getAppProperty("timeoutNotConfirm", "30"));
    }
    /**
     * 模糊搜索的服务商code
     */
    public String getSearchLocationSupplierCode() {
        return getAppProperty("searchLocation.supplierCode", "");
    }
    /**
     * 模糊搜索的服务商corpId
     */
    public String getSearchLocationSupplierCorpId() {
        return getAppProperty("searchLocation.supplierCorpId", "");
    }
    /**
     * 酒店查询接口超时时间，单位：秒
     */
    public Long getSupplierTimeOut() {
        return Long.valueOf(getAppProperty("supplierTimeOut", "20"));
    }
    /**
     * 酒店列表缓存时间，单位：秒
     */
    public Long getHotelListCacheTime() {
        return Long.valueOf(getAppProperty("HotelListCacheTime", "1800"));
    }

    public Boolean getNameConvertSwitch(){
        return Boolean.valueOf(getAppProperty("name.convert.switch","false"));
    }
    /**
     * 列表停留时间
     *
     * @return
     */
    public Long getHotelListResidentTime() {
        return Long.parseLong(getAppProperty("hotel_list.resident_time", "570"));
    }

}
